//导入axios工具包
import instance from '@/utils/axios.js'

//1.查询所有分类
function getArticleCategory () {
  return instance({
    url: '/admin/category/list',
    method: 'get'
  })
}
//导出接口
export { getArticleCategory }

//2.新增分类
function addArticleCategory ({ name, slug }) {
  return instance({
    url: '/admin/category/add',
    method: 'post',
    data: { name, slug }
  })
}
//导出接口
export { addArticleCategory }

//3.编辑分类
function editArticleCategory ({ id, name, slug }) {
  return instance({
    url: '/admin/category/edit',
    method: 'post',
    data: { id, name, slug }
  })
}
//导出接口
export { editArticleCategory }

//4.删除分类
function deleteArticleCategory (id) {
  return instance({
    url: '/admin/category/delete',
    method: 'post',
    data: { id }
  })
}
//导出接口
export { deleteArticleCategory }

//5.请求文章列表
function getArticleList (obj) {
  return instance({
    url: '/admin/article/query',
    method: 'get',
    params: obj
  })
}
//导出接口
export { getArticleList }

//5.删除文章
function deleteArticleList (id) {
  return instance({
    url: '/admin/article/delete',
    method: 'post',
    data: { id }
  })
}
//导出接口
export { deleteArticleList }

//6.发布文章
function releaseArticle (fd) {
  return instance({
    url: '/admin/article/publish',
    method: 'post',
    data: fd
  })
}
//导出接口
export { releaseArticle }

//7.编辑文章
function editArticle (fd) {
  return instance({
    url: '/admin/article/edit',
    method: 'post',
    data: fd
  })
}
//导出接口
export { editArticle }
